export default {
	namespaced: true,
	state: {
		orders: {
			// created: null,
			// goodsArr: null,
		},
	},
	getters: {
		//订单剩余时间
		countdown(state) {
			//30分钟后订单取消
			console.log("触发order", state?.orders?.created);

			if (state?.orders?.created) {
				let now = new Date().getTime();
				let time = state.orders.created + 30 * 60 * 1000 - now;
				if (time <= 0) {
					return false;
				}
				return time;
			} else {
				return false;
			}
		},
	},
	mutations: {
		setOrders(state, orders) {
			state.orders = orders;
			// console.log("当前orders：", orders);
			console.log("当前订单信息：", state.orders);
		},
	},
	actions: {},
	modules: {},
};
